<?php


// Use custom admin header/footer

pref('[Loop]/views/pathToSnippetHeader.html', '/Html/Snippet.Header.html');
pref('[Loop]/views/pathToSnippetFooter.html', '/Html/Snippet.Footer.html');


// Dependencies

require_once(PATH_APPLICATION . 'Model/CAccount.php');
require_once(PATH_APPLICATION . 'Model/CPostStatus.php');

$account = new Snsfg\CAccount();

$rawAccounts = $account->find
				(
					array
					(
						'acceptTemporaryObjects' => true,
						'conditions' =>  array 
						(
							'universe' => array(EQUAL, 'demo_cn')
						),
						'orderBy' => array('timeOfCreation'),
						'orderDirection' => 'ascendent'
					)
				);


$rawAccountIds = array();

foreach($rawAccounts as $rawAccount) {
	$rawAccountIds[] = $rawAccount['internalId'];
}

$status = new Snsfg\CPostStatus();


$rawStatuses = $status->find
				(
					array
					(
						'conditions' =>  array 
						(
							'accountId' => array(IN, $rawAccountIds)
						),
						'orderBy' => array('timeOfCreation'),
						'orderDirection' => 'descendent'
					)
				);

v('rawAccounts', $rawAccounts);
v('rawStatuses', $rawStatuses);
v('status', $status);
v('account', $account)
?>